<?php
	class LoginView {
		private $m_getPassword = "password";
		private $m_getUsername = "username";
		private $m_loginButton = "loginbutton";
		private $m_logoutButton = "logoutbutton"; //Namnen på alla inputs
		
		/**
		 * @return string loginBox
		 */
		public function DoLoginBox() {
			return "<div>
						<form method='post'>
							<fieldset>
								<label for='username'>Username: </label>
								<input name='username' type='text'/><br />
								<label for='password'>Password: </label>
								<input name='password' type='text'/><br />
								<input name='loginbutton' type='submit' value='Login'> 
								<label for='checkbox'>Remember me </label><input name='checkbox' type='Checkbox' />
							</fieldset>
						</form>
					</div>";
		}
		
		/**
		 * @return string logoutBox
		 */
		public function DoLogoutBox() {
			return "<div>
						<form method='post'>
							<fieldset>
								<input type='submit' name='logoutbutton' value='Logout'/>
							</fieldset>
						</form>
					</div>";
		}
		
		/**
		 * Gets username from input data
		 * @return string Username from input
		 */
		public function GetUserName() {
			if(isset($_POST[$this->m_getUsername])) {
				return $_POST[$this->m_getUsername];
			} else {
				return NULL;
			}
		}
		
		/**
		 * Gets password from input data
		 * @return string Password from input
		 */
		public function GetPassword() {
			if(isset($_POST[$this->m_getPassword])) {
				return $_POST[$this->m_getPassword];
			} else {
				return NULL;
			}
		}
		
		/**
		 * Gets loginButton from input data
		 * @return boolean loginButton from input data
		 */
		public function TriedToLogin() {
			if(isset($_POST[$this->m_loginButton])) {
				return true;
			} else {
				return false;
			}
		}
		
		/**
		 * Gets logoutButton from input data
		 * @return boolean logoutButton from input data
		 */
		public function TriedToLogout() {
			if(isset($_POST[$this->m_logoutButton])) {
				return true;
			} else {
				return false;
			}
		}
	}
?>